Assignemnt #56 and 54 program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: 54th Program
///File name: FiftProg.java
///Date Finished:11/5/2015
import java.util.Random;
public class FiftProg
{
public static void main( String[] args )
{
Random r = new Random();
int x = 1 + r.nextInt(6);
if(x == 1)
{
System.out.println( "Fortune cookie says: \"Stick with your wife\"." );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.println( "" );
}
else if(x == 2)
{
System.out.println( "Fortune cookie says: \"Buy a dog\"." );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.println( "" );
}
else if(x == 3)
{
System.out.println( "Fortune cookie says: \"Don't have kids\"." );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.println( "" );
}
else if(x == 4)
{
System.out.println( "Fortune cookie says: \"Good fortune is in your near future\"." );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.println( "" );
}
else if(x == 5)
{
System.out.println( "Fortune cookie says: \"Don't wear blue tomorrow\"." );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.println( "" );
}
else if(x == 6)
{
System.out.println( "Fortune cookie says: \"order the ramen next time\"." );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.println( "" );
}
}
}
Picture of the output